package com.nami.store.api.bo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


public class UserWrap implements Serializable {

    /**
     * 用户appKey
     */
    private String appKey;


    private String userId;

    /**
     * 昵称
     */
    private String nick;

    /**
     * 头像
     */
    private String avatar;

    /**
     * 状态
     */
    private Integer status;

    /**
     * 用户客户端第一个登录的设备ip
     */
    private String firstLoginIp;

    /**
     * 设备
     */
    private List<UserDevice> deviceInfos;

    public String getAppKey() {
        return appKey;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getFirstLoginIp() {
        return firstLoginIp;
    }

    public void setFirstLoginIp(String firstLoginIp) {
        this.firstLoginIp = firstLoginIp;
    }

    public List<UserDevice> getDeviceInfos() {
        return deviceInfos;
    }

    public void setDeviceInfos(List<UserDevice> deviceInfos) {
        this.deviceInfos = deviceInfos;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public UserWrap() {
    }

    /**
     * deep clone constructor
     *
     * @param other the User object to be cloned
     */
    public UserWrap(UserWrap other) {
        this.userId = other.getUserId();

        this.nick = other.getNick();
        this.avatar = other.getAvatar();

        this.status = other.getStatus();
        this.appKey = other.getAppKey();
        this.firstLoginIp = other.getFirstLoginIp();

        List<UserDevice> deviceInfos1 = other.getDeviceInfos();
        if (deviceInfos1 != null) {
            List<UserDevice> newDeviceInfos = new ArrayList<UserDevice>(deviceInfos1);
            UserDevice item;
            for (UserDevice deviceInfo : deviceInfos1) {
                if (deviceInfo == null) {
                    continue;
                }
                item = new UserDevice();
                item.setUserIp(deviceInfo.getUserIp());
                item.setDeviceType(deviceInfo.getDeviceType());
                item.setDubboIp(deviceInfo.getDubboIp());
                item.setDubboPort(deviceInfo.getDubboPort());
                item.setMqTags(deviceInfo.getMqTags());
                newDeviceInfos.add(deviceInfo);
            }
            this.deviceInfos = newDeviceInfos;
        }
    }

    /**
     * deep clone method
     *
     * @return a new User object that is a deep copy of this object
     */
    public UserWrap clone() {
        return new UserWrap(this);
    }

}
